{extend name="common/layout" /}
{block name="main"}
<div class="admin-main fadeInUp animated" ng-app="hd" ng-controller="ctrl">
    <div class="padding30">
        <h3 class="page-box-title">{:lang('Subscribe Setting')}</h3>
        <blockquote class="layui-elem-quote layui-text" style="width: 600px;">
           <h4 class="layui-note-title">{:lang('Relevant instructions:')}</h4>
    <!--       <p>{:lang('Please fill in the following information form, number (*) are required.')}</p>
     -->      <p class="layui-note-content">{:lang('After submission, the sending line expires to remind you of the email address you entered.')}</p>
          <p class="layui-note-content">{:lang('take_notice1')}</p>
          <p class="layui-note-content">{:lang('take_notice2')}</p>
          <p class="layui-note-content">{:lang('take_notice3')}</p>
          <p class="layui-note-content">{:lang('take_notice4')}</p>
        </blockquote>
    </div>
    <div class="layui-form-box">
    <form class="layui-form ">
        <input type="hidden" value="{$row['id']}" name="id" />
        <div class="layui-form-item">
            <label class="layui-form-label">{:lang('Subscription type')}</label>
            <div class="layui-input-6">
                <select name="type" lay-filter="type" lay-verify="required">
                    <option value="">{:lang('Please Select Type')}</option>
                    <?php foreach($types as $index=>$type):?>
                        <option value="{$index}" <?php if($row['type'] == $index){echo "selected";}?> >{$type}</option>
                    <?php endforeach;?>
                </select>
            </div>
        </div>
        
        <div class="layui-form-item">
            <label class="layui-form-label"> *{:lang('Send Mailbox')} 1</label>
            <div class="layui-input-6">
                <input name="email" lay-verify="required" value="{$row['email']}" placeholder="" autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
         <div class="layui-form-item">
            <label class="layui-form-label"> {:lang('Send Mailbox')} 2</label>
            <div class="layui-input-6">
                <input name="email2" value="{$row['email2']}" placeholder="" autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> *{:lang('Time Cycle')}</label>
            <div class="layui-input-6">
               <select name="month" lay-filter="month" lay-verify="required">

                    <option value="1" <?php if($row['month'] == 1){echo "selected";}?> >{:lang('Every Month')}</option>
                    <option value="3" <?php if($row['month'] == 3){echo "selected";}?> >{:lang('Every Quarter')}</option>
                    <option value="6" <?php if($row['month'] == 6){echo "selected";}?> >{:lang('Half a year')}</option>
                    <option value="12" <?php if($row['month'] == 12){echo "selected";}?> >{:lang('Every Year')}</option>
                </select>
            </div>
        </div>
        <br/>
        <br/>
        <div class="layui-form-item layui-btn-block">
            <div class="layui-input-block" style="margin-left:0px;">
                <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button>
            </div>
        </div>
    </form>
</div>
    <br/>
    <br/>

</div>
{/block}
{block name="footer"}
<script>
    var m = angular.module('hd',[]);
    m.controller('ctrl',['$scope',function($scope) {
        //$scope.field = '{$info}'!='null'?{$info}:{name:''};
        layui.use(['form', 'layer'], function () {
            var form = layui.form, layer = layui.layer,$= layui.jquery;
            form.on('submit(submit)', function (data) {
                loading = layer.load(1,{shade:[0.1,'#fff']});
                // 提交到方法 默认为本身
                //data.field.id = $scope.field.id;
                $.post("", data.field, function (res) {
                    layer.close(loading);
                    if (res.code > 0) {
                        layer.msg(res.msg, {time: 1800, icon: 1}, function () {
                            location.href = res.url;
                        });
                    } else {
                        layer.msg(res.msg, {time: 1800, icon: 2});
                    }
                });
            })
        });
    }]);
</script>
{/block}